package com.jj.exception;

import com.jj.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
//全局异常处理器
@RestControllerAdvice
//@ControllerAdvice + @RestBody = @RestControllerAdvice
public class GlobaExceptionHandler {
//指定异常拦截类型
    @ExceptionHandler(Exception.class)
    public Result ex(Exception ex){
        ex.printStackTrace();
        return Result.error("服务器异常");
    }

}
